var mongoose = require('mongoose');

var userSchema = new mongoose.Schema({
  "userId":String,
  "userName":String,
  "userPwd":String,
  "orderList":[
    {
      "orderId":String,
      "orderTotal":String,
      "addressInfo":[
      {
          "addressId":String,
          "userName":String,
          "stressName":String,
          "postCode":Number,
          "tel":Number,
          "isDefault":Boolean
      }],
      "goodsList":[{
          "productId":String,
          "productName":String,
          "salePrice":Number,
          "productImage":String,
          "productNum":Number,
          "checked":Number
      }],
      "orderStatus":String,
      "cteateDate":String
    }
  ],
  "cartList":[
    {
    	"productImage":String,
      "salePrice":String,
      "productName":String,
      "productId":String,
      "checked":String,
      "productNum":String
    }
  ],
  "addressList":[
    {
      "addressId":String,
      "userName":String,
      "stressName":String,
      "postCode":Number,
      "tel":Number,
      "isDefault":Boolean
    }
  ]
})

module.exports = mongoose.model("User",userSchema,"users")